package com.sat.wisdom.Activities;

import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.sat.wisdom.Fragments.ContentFragment;
import com.sat.wisdom.Fragments.LeftMenuFragment;
import com.sat.wisdom.R;
public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initFragment();
    }

    private void initFragment() {
        FragmentManager fm = getFragmentManager();
        FragmentTransaction transaction = fm.beginTransaction();
        transaction.replace(R.id.fl_left_menu,new LeftMenuFragment(),"TAG_LEFT_MENU");
        transaction.replace(R.id.fl_right_content,new ContentFragment(),"TAG_CONTENT");
        transaction.commit();
    }

    public LeftMenuFragment getLeftMenuFragment(){
        FragmentManager fm = getFragmentManager();
        return (LeftMenuFragment)fm.findFragmentByTag("TAG_LEFT_MENU");
    }
    public ContentFragment getContentFragment(){
        FragmentManager fm = getFragmentManager();
        return (ContentFragment)fm.findFragmentByTag("TAG_CONTENT");
    }
}
